package com.xiao.train.business.controller.admin;

import com.xiao.train.business.service.DailyTrainSeatService;
import com.xiao.train.common.resp.CommonResp;
import com.xiao.train.business.req.DailyTrainSeatQueryReq;
import com.xiao.train.business.req.DailyTrainSeatSaveReq;
import jakarta.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("admin/daily-train-seat")
public class DailyTrainSeatAdminController {

    @Autowired
    DailyTrainSeatService dailyTrainSeatService;

    @PostMapping("save")
    public CommonResp save(@Valid @RequestBody DailyTrainSeatSaveReq req) {
        dailyTrainSeatService.save(req);
        return new CommonResp();
    }

    @GetMapping("query-list")
    public CommonResp queryList(@Valid DailyTrainSeatQueryReq req) {
        return new CommonResp(dailyTrainSeatService.queryList(req));
    }

    @DeleteMapping("delete/{id}")
    public CommonResp delete(@PathVariable Long id) {
        dailyTrainSeatService.delete(id);
        return new CommonResp();
    }
}